<!--添加企业服务人员-->
<div class="md-modal md-effect-2" id="modal-21">
    <div class="md-content">
        <div class="modal-header">
            <button class="md-close close">&times;</button>
            <h4 class="modal-title">编辑企业从业人员</h4>
        </div>
        <div class="modal-body">
            <form role="form">
                <div class="form-group">
                    <label>用户名（唯一）</label>
                    <div>
                        <input type="text" class="form-control" ng-model="s_manager.account" placeholder="请输入用户名">
                    </div>
                </div>
                <div class="form-group">
                    <label>昵称</label>
                    <div>
                        <input type="text" class="form-control" ng-model="s_manager.nickname" placeholder="请输入用户名">
                    </div>
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <div>
                        <input type="text" class="form-control" ng-model="s_manager.password" placeholder="请输入密码">
                    </div>
                </div>
                <div class="form-group">
                    <label>小组</label>
                    <div>
                        <select class="form-control" ng-model="s_manager.group_id"
                                ng-options="g._id as g.groupName for g in groupList">
                            <option value="">请选择小组</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label>类型</label>
                    <div>
                        <input type="text" class="form-control" disabled="disabled" value="企业业务员"/>
                    </div>
                </div>
            </form>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-primary" ng-click="saveCompanyService(s_manager)">保存</button>
        </div>
    </div>
</div>
<div class="md-overlay"></div>

<div class="col-lg-12">
    <!--当前位置 start-->
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb">
                <li><a><i class="fa fa-home mrg-r-sm"></i>首页</a></li>
                <li class="active"><span>新增服务站</span></li>
            </ol>
        </div>
    </div>
    <!--当前位置 end-->

    <!--代码写在这里-->
    <div class="row">
        <div class="col-lg-12">
            <div class="main-box">
                <header class="main-box-header clearfix">
                    <h2>&nbsp;</h2>
                </header>
                <div class="main-box-body clearfix">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">名称</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.name" placeholder="请输入名称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">公司编码</label>
                            <div class="col-lg-6">
                                <input class="form-control" type="text" ng-show="pageType=='create'"
                                       ng-model="company.code" placeholder="请输入code">
                                <input class="form-control" type="text" ng-show="pageType=='edit'" disabled="disabled"
                                       ng-model="company.code" placeholder="请输入code">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">法人</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control " ng-model="company.faren" placeholder="法人">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">地址 </label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.address" placeholder="请输入地址">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">注册年份</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.create_time"
                                       placeholder="请输入注册年份">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">负责人</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.fuzeren" placeholder="请输入负责人">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">经营时长</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.years" placeholder="请输入经营时长">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">联系电话</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.telephone"
                                       placeholder="请输入联系电话">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">公司logo</label>
                            <div class="col-lg-6">
                                <img style="width: 120px;height:120px;" ng-if="company.logo!= ''&& company.logo!= undefined"
                                     src="{{URL+company.logo}}">
                                <input type="hidden" ng-model="company.logo">
                                <ul id="J_UploaderQueue" class="grid"></ul>
                                <div class="grid">
                                    <input type="file" class="form-control" id="J_UploaderBtn" value="上传图片"
                                           name="Filedata">
                                    <input type="hidden" id="J_Urls" name="urls" value=""/>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">服务人员数量</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.member_number"
                                       placeholder="请输入名称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">经度</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.longitude "
                                       placeholder="请输入经度">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">纬度</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" ng-model="company.latitude  "
                                       placeholder="请输入纬度">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">自动接收</label>
                            <div class="col-lg-10">
                                <div class="radio radio-inline">
                                    <input name="optionsRadios1" id="optionsRadios3" value="1"
                                           ng-model="company.autoAddOrder" type="radio">
                                    <label for="optionsRadios3">
                                        是
                                    </label>
                                    <input name="optionsRadios1" id="optionsRadios4" value="0"
                                           ng-model="company.autoAddOrder" type="radio">
                                    <label for="optionsRadios4">
                                        否
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">服务项目</label>
                            <div class="col-lg-10">
                                <table class="form_table" border="1">
                                    <tbody ng-repeat="item in  serviceListNew1">
                                    <tr>
                                        <td colspan="2" class="table_title">{{item.title}}</td>
                                    </tr>
                                    <tr ng-repeat="item2 in  item.child">
                                        <td class="table_title1">{{item2.title}}</td>
                                        <td>
                                            <div class="checkbox-nice checkbox-inline "
                                                 ng-repeat="item3 in item2.child">
                                                <input id="checkbox-in3-{{item3.code}}" type="checkbox"
                                                       ng-model="item3.chk">
                                                <label for="checkbox-in3-{{item3.code}}">
                                                    {{item3.title}}
                                                </label>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>

                                <!--<table>
                                    <tr><td>服务大类</td><td>服务中类</td><td>服务小类</td></tr>
                                    <tr ng-repeat="item in  serviceList"  rowspan="{{item.service2.length}}">
                                        <td>{{item.service1.title}}</td>
                                        <td>

                                        </td>
                                        <td>

                                        </td>
                                    </tr>
                                </table>-->

                            </div>
                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-6">
                                    <a class="btn btn-primary" ng-click="edit(company )">保存</a>
                                    <a class="btn btn-primary" href="#/company/list">返回</a>
                                    <a class="btn btn-primary md-trigger" ng-click="openEdit([],0)"
                                       data-modal="modal-21" ng-show="pageType=='edit'">添加企业服务人员</a>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row" ng-show="pageType=='edit'">
        <div class="col-lg-12">
            <div class="main-box no-header clearfix">
                <div class="main-box-body clearfix">
                    <div class="table-responsive">
                        <table class="table user-list table-hover">
                            <thead>
                            <tr>
                                <th class="text-center">昵称</th>
                                <th class="text-center">用户名</th>
                                <th class="text-center">密码</th>
                                <th class="text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr id="{{company.code}}" ng-repeat="user in userList" on-finish-render-filters>
                                <th class="text-center">{{user.nickname}}</th>
                                <th class="text-center">{{user.account}}</th>
                                <th class="text-center">{{user.password}}</th>
                                <th class="text-center">
                                    <a class="table-link md-trigger" ng-click="openEdit(user,user._id)"
                                       data-modal="modal-21">
										<span class="fa-stack">
										    <i class="fa fa-square fa-stack-2x"></i>
										    <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
										</span>
                                    </a>
                                    <a ng-click="delCompanyAdmin(user._id)" class="table-link danger">
										<span class="fa-stack">
										    <i class="fa fa-square fa-stack-2x"></i>
										    <i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
										</span>
                                    </a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="../default/js/modernizr.custom.js"></script>
<script src="../default/js/classie.js"></script>
<script src="../default/js/modalEffects.js"></script>
<script type="text/javascript">
    function init() {
        var overlay = document.querySelector('.md-overlay');
        [].slice.call(document.querySelectorAll('.md-trigger')).forEach(function (el, i) {
            var modal = document.querySelector('#' + el.getAttribute('data-modal')),
                    close = modal.querySelector('.md-close');

            function removeModal(hasPerspective) {
                classie.remove(modal, 'md-show');
                if (hasPerspective) {
                    classie.remove(document.documentElement, 'md-perspective');
                }
            }

            function removeModalHandler() {
                removeModal(classie.has(el, 'md-setperspective'));
            }

            el.addEventListener('click', function (ev) {
                classie.add(modal, 'md-show');
                overlay.removeEventListener('click', removeModalHandler);
                overlay.addEventListener('click', removeModalHandler);
                if (classie.has(el, 'md-setperspective')) {
                    setTimeout(function () {
                        classie.add(document.documentElement, 'md-perspective');
                    }, 25);
                }
            });
            close.addEventListener('click', function (ev) {
                ev.stopPropagation();
                removeModalHandler();
            });
            $(document).keyup(function (e) {
                if (e.keyCode == 27) {
                    e.stopPropagation();
                    removeModalHandler();
                }
            });
        });
    }
    function closeMod() {
        $(".md-close").click();
    }
    init();
</script>